import React, { Component } from 'react'

export default class extends Component {
  constructor (props) {
    super(props)
    this.state = {
      count: 1
    }
  }

  shouldComponentUpdate (nextProps, nextState) {
    if (this.props.color !== nextProps.color) {
      return false
    }
    if (this.props.count !== nextState.count) {
      return true
    }
    return false
  }

  render () {
    <button 
      color={this.props.color}
      onClick={() => this.setState(state => ({count: state.count + 1}))}
    >
      Count: {this.state.count}
    </button>
  }
}